#pragma once

#include <engine.input/Device.hpp>
#include <engine.core/quad.hpp>

#include "exports.hpp"

#pragma warning (push)
#pragma warning (disable: 4251)




namespace Engine
{
	namespace Ui
	{
		class ENGINE_UI_API Cursor
		{
		public:

			/**
			 * Create a cursor.
			 */
			Cursor(Input::Device::ptr inputDevice);

			/**
			 * Create a cursor from another one, but offsetting it by a specific vector.
			 */
			Cursor(const Cursor& that, const int2& offset);



			int2 offset() const;
			void setOffset(const int2& offset);

			/**
			 * Get the position of the cursor.
			 */
			int2 pos() const;

			/**
			 * Get the screen position of the cursor.
			 */
			int2 screenPos() const;

			/**
			 * Get the amount of pixels the mouse has moved from the last frame
			 * to this one.
			 */
			int2 delta() const;



			/**
			 * Test if the given button has been pressed this update.
			 */
			bool keyDown(Key::Type key) const;

			/**
			 * Test if the given button is down (it may have been down since several updates.
			 */
			bool keyPressed(Key::Type key) const;

			/**
			 * Test if the given button has been released this update.
			 */
			bool keyClicked(Key::Type key) const;

		private:

			/// Offset that is added to the cursor position
			int2                 m_offset;

			/// The size of the cursor in pixels, usually (32, 32)
			int2                 m_size;

			Input::Device::ptr   m_inputDevice;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////

#pragma warning (pop)
